package com.yzt.zhuju.network.biz;

import com.alibaba.fastjson.JSONObject;
import com.yzt.zhuju.network.NetLayer;
import com.yzt.zhuju.network.apiconfig.GiftUrlConstant;
import com.yzt.zhuju.network.entity.gift.SendChatRoomGiftRequest;

import okhttp3.RequestBody;
import rx.Observable;
import rx.Observer;

/**
 * author : bob
 * date   : 2022/12/6
 * desc   :
 */
public class GiftModule extends BaseModule {

    /**
     * 获取礼物列表
     */
    public void getGiftList(Observer observer) {
        JSONObject json = new JSONObject();
        json.put("current", 1);
        json.put("pageSize", 999);
        Observable observable = NetLayer.getInstance().getGiftService().getGiftList(getRequestBody(json));
        toSubscribe2Filter(observable, observer, GiftUrlConstant.GET_GIFT_LIST);
    }

    /**
     * 赠送礼物
     */
    public void postSendGiftToOther(JSONObject json, Observer observer) {
        Observable observable = NetLayer.getInstance().getGiftService().postSendGiftToOther(getRequestBody(json));
        toSubscribe2Filter(observable, observer, GiftUrlConstant.POST_SEND_GIFT_TO_OTHER);
    }

    /**
     * 赠送连击礼物
     */
    public void postSendMyChatRoomComboGift(SendChatRoomGiftRequest mSendChatRoomGiftRequest, Observer observer) {
        RequestBody mRequestBody = getRequestBody(mSendChatRoomGiftRequest);
        Observable observable = NetLayer.getInstance().getGiftService().postSendChatRoomComboGift(mRequestBody);
        toSubscribe2Filter(observable, observer, GiftUrlConstant.POST_SEND_MY_CHAT_ROOM_COMBO_GIFT);
    }

    /**
     * 发出(主动发出惩罚牌)
     */
    public void postPunishToOther(JSONObject json, Observer observer) {
        Observable observable = NetLayer.getInstance().getGiftService().postPunishToOther(getRequestBody(json));
        toSubscribe2Filter(observable, observer, GiftUrlConstant.POST_SEND_PUNISH_TO_OTHER);
    }

    /**
     * (惩罚牌)  摇一摇
     */
    public void postPunishShark(JSONObject json, Observer observer) {
        Observable observable = NetLayer.getInstance().getGiftService().postPunishShark(getRequestBody(json));
        toSubscribe2Filter(observable, observer, GiftUrlConstant.POST_SEND_PUNISH_SHARK);
    }
}
